package com.banzhi.shop.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.banzhi.shop.R;
import com.banzhi.shop.base.BaseActivity;
import com.banzhi.shop.entity.My.MySuperior_data;
import com.banzhi.shop.utils.ASUtils;
import com.banzhi.shop.utils.Translucent;
import com.banzhi.shop.view.CircleImageView;
import com.squareup.picasso.Picasso;

//我的推荐人

public class MyUpPeopleActivity extends BaseActivity implements View.OnClickListener {
    private ImageView ivback;
    private TextView tvname;
    private LinearLayout llname;
    private LinearLayout llimage;
    private CircleImageView civ_image;
    private LinearLayout llphone;
    private TextView tvphone;
    private MySuperior_data data;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_up_people);
        Translucent.setTranslucent(this);
        Intent intent = getIntent();
        data = (MySuperior_data) intent.getSerializableExtra("data");
        setinits();
        setListeners();
    }

    private void setinits() {
        ivback = (ImageView) findViewById(R.id.iv_back);
        tvname = (TextView) findViewById(R.id.tv_name);
        tvphone = (TextView) findViewById(R.id.tv_phone);
        civ_image = (CircleImageView) findViewById(R.id.civ_image);
        llimage = (LinearLayout) findViewById(R.id.ll_image);
        llname = (LinearLayout) findViewById(R.id.ll_name);
        llphone = (LinearLayout) findViewById(R.id.ll_phone);
        tvname.setText(data.getNickname());
        tvphone.setText(data.getMobile());
        if (ASUtils.isCanUse(data.getAvatar())) {
            Picasso.with(this).load(data.getAvatar()).placeholder(R.mipmap.zhanweitu2).into(civ_image);
        }
    }

    private void setListeners() {
        ivback.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
        }
    }
}
